package com.designpatterns.template;

public abstract class CarModel {
    abstract void start();

    abstract void alarm();

    abstract void stop();

    /**
     * 钩子函数
     * @return
     */
    protected boolean isAlarm(
    ) {
        return true;
    }

    public void run(){
        start();
        if(isAlarm()){
            alarm();
        }
        stop();
    }

}
